package com.eastfair.projectcore.entity;

import cn.afterturn.easypoi.excel.annotation.Excel;
import cn.afterturn.easypoi.excel.annotation.ExcelEntity;
import com.baomidou.mybatisplus.annotation.TableName;
import com.baomidou.mybatisplus.annotation.IdType;
import com.eastfair.core.base.entity.Entity;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableField;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import javax.validation.constraints.NotEmpty;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Size;
import java.time.LocalDateTime;
import java.util.HashMap;
import java.util.Map;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.NoArgsConstructor;
import lombok.ToString;
import lombok.experimental.Accessors;
import static com.eastfair.core.utils.DateUtils.DEFAULT_DATE_TIME_FORMAT;
import com.eastfair.annotation.model.EchoVO;

import static com.baomidou.mybatisplus.annotation.SqlCondition.LIKE;

/**
 * <p>
 * 实体类
 * 配置模块属性表
 * </p>
 *
 * @author zjn
 * @since 2021-11-09
 */
@Data
@NoArgsConstructor
@ToString(callSuper = true)
@EqualsAndHashCode(callSuper = true)
@Accessors(chain = true)
@TableName("c_config_attribute")
@ApiModel(value = "ConfigAttribute", description = "配置模块属性表")
@AllArgsConstructor
public class ConfigAttribute extends Entity<Long> implements EchoVO {

    private static final long serialVersionUID = 1L;
    @TableField(exist = false)
    private Map<String, Object> echoMap = new HashMap<>();
    /**
     * 实体编码
     */
    @ApiModelProperty(value = "实体编码")
    @Size(max = 64, message = "实体编码长度不能超过64")
    @TableField(value = "entity_class", condition = LIKE)
    @Excel(name = "实体编码")
    private String entityClass;

    /**
     * 属性编码
     */
    @ApiModelProperty(value = "属性编码")
    @Size(max = 128, message = "属性编码长度不能超过128")
    @TableField(value = "attribute_code", condition = LIKE)
    @Excel(name = "属性编码")
    private String attributeCode;

    /**
     * 属性名称
     */
    @ApiModelProperty(value = "属性名称")
    @Size(max = 64, message = "属性名称长度不能超过64")
    @TableField(value = "attribute_name", condition = LIKE)
    @Excel(name = "属性名称")
    private String attributeName;

    /**
     * 属性值类型
     */
    @ApiModelProperty(value = "属性值类型")
    @Size(max = 128, message = "属性值类型长度不能超过128")
    @TableField(value = "attribute_type", condition = LIKE)
    @Excel(name = "属性值类型")
    private String attributeType;

    /**
     * 属性值取值范围（只有单选，多选有，读取数据字典，存储数据字典类型code）
     */
    @ApiModelProperty(value = "属性值取值范围（只有单选，多选有，读取数据字典，存储数据字典类型code）")
    @Size(max = 128, message = "属性值取值范围（只有单选，多选有，读取数据字典，存储数据字典类型code）长度不能超过128")
    @TableField(value = "attribute_type_code", condition = LIKE)
    @Excel(name = "属性值取值范围（只有单选，多选有，读取数据字典，存储数据字典类型code）")
    private String attributeTypeCode;

    /**
     * 排序
     */
    @ApiModelProperty(value = "排序")
    @TableField(value = "sequence")
    @Excel(name = "排序")
    private Integer sequence;

    /**
     * 是否生效：1是；0否
     */
    @ApiModelProperty(value = "是否生效：1是；0否")
    @TableField(value = "is_enabled")
    @Excel(name = "是否生效：1是；0否")
    private Integer isEnabled;

    /**
     * 是否删除：1是；0否
     */
    @ApiModelProperty(value = "是否删除：1是；0否")
    @TableField(value = "is_deleted")
    @Excel(name = "是否删除：1是；0否")
    private Integer isDeleted;


    @Builder
    public ConfigAttribute(Long id, Long createdBy, LocalDateTime createTime, Long updatedBy, LocalDateTime updateTime, 
                    String entityClass, String attributeCode, String attributeName, String attributeType, String attributeTypeCode, 
                    Integer sequence, Integer isEnabled, Integer isDeleted) {
        this.id = id;
        this.createdBy = createdBy;
        this.createTime = createTime;
        this.updatedBy = updatedBy;
        this.updateTime = updateTime;
        this.entityClass = entityClass;
        this.attributeCode = attributeCode;
        this.attributeName = attributeName;
        this.attributeType = attributeType;
        this.attributeTypeCode = attributeTypeCode;
        this.sequence = sequence;
        this.isEnabled = isEnabled;
        this.isDeleted = isDeleted;
    }

}
